package com.trade.common.utils.model;

/**
 * 返回值实体类
 */
public class Result {
    private String code; //返回代码
    private String msg; //返回信息
    private String url; //调用地址
    private String error; //错误信息
    private Object content; //返回内容

    /**
     * 构造函数
     */
    public Result() {
        super();
    }

    /**
     * 构造函数
     * @param code 返回代码
     * @param msg 返回信息
     */
    public Result(String code, String msg) {
        super();
        this.code = code;
        this.msg = msg;
    }

    /**
     * 设置值
     */
    public Result set(String code, String msg) {
        this.code = code;
        this.msg = msg;
        return this;
    }

    /**
     * 获取返回值信息
     */
    public String info() {
        return this.code + "\n" + this.msg + "\n" + this.error;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUrl() {
        return url;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getError() {
        return error;
    }

    public void setContent(Object content) {
        this.content = content;
    }

    public Object getContent() {
        return content;
    }

    /**
     * 接口请求响应关键字
     *
     * @author zhaofb@hvgroup.com.cn
     */
    public static final class Key
    {
        /** 结果代码 */
        public static final String RESULT_CODE = "resultcode";
        /** 结果消息 */
        public static final String RESULT_MSG = "resultmsg";
        /** 缓存时间 */
        public static final String RESULT_TIME = "time";
        /** 是否使用缓存 */
        public static final String RESULT_USECACHE = "usecache";
    }
}